//
// Created by mac on 2/22/22.
//
#include <vector>
using  namespace std;

bool searchMatrix(vector<vector<int>>& matrix, int target) {
    int m = matrix.size(), n = matrix[0].size();
    int row = m - 1, col = 0;
    while (row >= 0 && col < n) {
        if (matrix[row][col] == target) return true;
        else if (matrix[row][col] < target) col++;
        else row--;
    }
    return false;

}